All Questions
Tagged with algorithmmathematics
108 questions
2votes
0answers
134views
How to make this arbitrary precision π calculator using Machin-like formula run faster?
Two days ago (or yesterday depending on your timezone) was π-day. So I thought it was a good day to calculate π. I used Machin-like formula to calculate π, in homage of William Shanks, who calculated ...
4votes
2answers
119views
Polynomial.java - multiplication algorithms: naïve, Karatsuba, FFT
Intro This post is a supplement to Polynomial.java - a Java class for dealing with polynomials with BigDecimal coefficients. It presents the three polynomial multiplication algorithms. Given two ...
3votes
2answers
723views
More Square Root
This is a follow up question to my Studies on Square Roots post. I'm posting additional code for solving for square root similar to the other, but with more code to benchmark. ...
8votes
4answers
959views
Studies on Square Roots
This post marks the beginning of my ventures into calculating square roots. However, I have no idea how the processor, more specifically the FPU with the fsqrt ...
6votes
3answers
1kviews
Implementation of Euler-Maruyama numerical solver
I am trying to write a python implementation of Euler-Maruyama and Milstein schemes for numerically solving stochastic differential equations. The pseudo-code for the algorithms is in the Wikipedia ...
0votes
1answer
49views
reassigning a variable with a divide operator gives nan in program when zero is entered [closed]
Please keep in mind that I am very new to programming. I was given a the following question as my assignment in C++: Write a program that computes the value of an nth degree polynomial $$A(x)=a_0+...
3votes
1answer
363views
Python function to find the count of digits of numerals in base n up to a given limit
This is a simple exercise to find the count of digits of all numerals in a given base up to a given limit (not including the limit), I wrote it to determine the ratio of bytes saved when the numbers ...
-2votes
1answer
192views
Design an algorithm to predict words based on a skeleton from a given dictionary
The model I'm building first selects a secret word at random from a list. The model which uses an API then returns a row of underscores (space separated)—one for each letter in the secret word—and ...
1vote
2answers
610views
Removing Elements from an Array Based on a Second Array
I've written a function that takes two arrays of integers as input and removes all the elements in the first array that are also present in the second array. I would like to share my code with you and ...
1vote
1answer
58views
Optimizing the Dig Pow function
I have written a Python function to solve the Dig Pow problem, where the goal is to find a number k such that the sum of each digit of n raised to a specific and ...
1vote
2answers
95views
Efficient N-Dimensional AABB Subdivision Algorithm
This is supposed to subdivide a n-dimensional aabb (axis aligned bounding box) into 2ⁿ equal pieces as if sliced by n planes that are perpendicular to only one axis and parallel to the rest of the ...
9votes
3answers
2kviews
Euler's brick generator in C++
I stumbled upon this unsolved problem of math named Euler's brick. I wrote a program in C++ to generate solutions for Euler's brick problem. It searches from ...
0votes
1answer
163views
Newton-raphson to find the square root of an arbitrarily sized number with arbitrary precision
I read here that "Furthermore, for a zero of multiplicity 1, the convergence is at least quadratic (see rate of convergence) in a neighbourhood of the zero, which intuitively means that the ...
4votes
4answers
1kviews
Count numbers that are the sum of three perfect cubes
From numbers from 1 to 100, count the numbers where the following equation is satisfied with 1 <= a <= 100, 1 <= b <= 100, and 1 <= c <= 100: $$a³ + b³ + c³$$ I have this: ...
3votes
1answer
566views
(Google Foobar XOR Checksum Challenge) How do i optimize this function to run for much larger values?
I wrote a function that accepts 2 integers start and length as input and returns the bitwise XOR of certain numbers as described below: ...